<%@page pageEncoding="utf-8" contentType="text/html; charset=utf-8"%>
<%@taglib prefix="s" uri="strutsTags"%>
<%@taglib prefix="ty" uri="/wyzzTags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<head>
	<base href="<%=basePath%>">
	<title>我的薪资发放列表</title>
	<link href="<s:url value="/resource/css/style.css"/>" rel="stylesheet"
		type="text/css" />
	<script type="text/javascript" src="resource/js/hrm/common.js"></script>
	<script type="text/javascript" src="resource/js/hrm/compensation.js"></script>
	<script type='text/javascript' src='dwr/interface/DWRforSalaryPaid.js'></script>
	<script type='text/javascript' src='dwr/interface/MySalaryPaid.js'></script>
	<jsp:include flush="true" page="../sitemesh/jsPackage.jsp"></jsp:include>
</head>
<body>
	<span class="errorMessage" id="message"></span>
	<jsp:include flush="true"
		page="../compensation/search_salary_paid_benediv.jsp"></jsp:include>
	<s:form id="mySalaryPaid" name="mySalaryPaid" action="basicSalaryPaid"
		namespace="/profile" method="POST">
		<s:token></s:token>
		<table width="100%" class="formtable">
			<tr>
				<td>
					<input type="hidden" id="operate" name="page.operate" />
					<s:hidden id="order" name="page.order" />
					<s:hidden id="page.currentPage" name="page.currentPage" />
					<s:hidden id="empId" name="empId" />
					<table width="100%">
						<tr>
							<td align="right">
								起始年月:
							</td>
							<td>
								<s:select id="inputStartYear" name="startYear" list="years"
									emptyOption="false" />
								<s:select id="inputStartMonth" name="startMonth"
									list="#{'01':'01','02':'02','03':'03','04':'04','05':'05','06':'06','07':'07','08':'08','09':'09','10':'10','11':'11','12':'12'}"
									emptyOption="false" />
							</td>
							<td>
								<label class="label" for="empName">
									结束年月:
								</label>
								<s:select id="inputEndYear" name="endYear" list="years"
									emptyOption="false" />
								<s:select id="inputEndMonth" name="endMonth"
									list="#{'01':'01','02':'02','03':'03','04':'04','05':'05','06':'06','07':'07','08':'08','09':'09','10':'10','11':'11','12':'12'}"
									emptyOption="false" />
							</td>
						</tr>
					</table>
				</td>
				<td>
					<input title="[Alt+F]" accesskey="F" name="sub_button"
						id="submit_button" class="button" type="button" size="4"
						onclick="checkYearAndMonth()" value="查询">
					<input title="[Alt+C]" accesskey="C" name="clear_button"
						class="button" type="button"
						onClick="window.location='basicSalaryPaid.action?empId=<s:property value="empId"/>';"
						value="重置">
				</td>
			</tr>
		</table>

		<!-- 操作 -->
		<div class="operatediv">
			<span class="operatedivleft"> </span>
			<span class="operatedivright">本次查询共得到<s:property
					value="page.totalRows" />条薪资历史记录</span>
		</div>

		<table id="salary_paid_table" cellpadding="0" cellspacing="0"
			width="100%" border="0" class="gridtableList">
			<tr>
				<th>
					<a href="#" onclick="hrm.common.order_submit('espYearmonth');">
						年-月</a>
					<img src='resource/images/arrow_.gif' width='8' height='10'
						id='espYearmonth_img'>
				</th>
				<th>
					员工编号
				</th>
				<th>
					员工姓名
				</th>
				<th colspan="2">
					基本工资
				</th>
				<th>
					税前总收入
				</th>
				<th colspan="2">
					社保总额
				</th>
				<th>
					所得税
				</th>
				<th>
					税后收入
				</th>
				<ty:auth auths="201">
					<th>
						薪资帐套
					</th>
				</ty:auth>
			</tr>

			<s:if test="!salaryPaidList.isEmpty()">
				<s:iterator value="salaryPaidList" status="index">
					<tr>
						<%--员工信息层的数据--%>
						<input type="hidden"
							id="salarypayID<s:property value="#index.count"/>"
							name="salarypayID<s:property value="#index.count"/>"
							value="<s:property value="id"/>" />
						<input type="hidden" id="empid<s:property value="#index.count"/>"
							name="empid<s:property value="#index.count"/>"
							value="<s:property value="espEmpno.id" />" />
						<input type="hidden"
							id="empName<s:property value="#index.count"/>"
							name="empName<s:property value="#index.count"/>"
							value="<s:property value="espEmpno.empName" />" />
						<input type="hidden"
							id="espComment<s:property value="#index.count"/>"
							name="espComment<s:property value="#index.count"/>"
							value="<s:property value="espComment" />" />
						<input type="hidden"
							id="espBenefitPlans<s:property value='#index.count'/>"
							name="espBenefitPlans<s:property value='#index.count'/>"
							value="<s:property value='espBenefitPlans' />" />
						<ty:auth auths="201 or 211">
							<input type="hidden"
								id="espEsacName<s:property value="#index.count"/>"
								name="espEsacName<s:property value="#index.count"/>"
								value="<s:property value="espEsavId.esavEsac.esacName" />" />
						</ty:auth>
						<td id="yearAndMonth<s:property value="#index.count"/>"
							align="center" nowrap="nowrap">
							<s:property value="yearAndMonth" />
						</td>

						<td id="empDistinctNo<s:property value="#index.count"/>"
							align="center" nowrap="nowrap">
							<s:property value='espEmpno.empDistinctNo' />
						</td>
						<td id="name<s:property value="#index.count"/>" align="center">
							<s:property value='espEmpno.empName' />
						</td>

						<td id="empBaseSalaryTD<s:property value="#index.count"/>"
							align="right" nowrap="nowrap">
							<span id="Basesalary_span<s:property value="#index.count"/>"><s:property
									value="showColumn1" /> </span>
						</td>
						<td align="left" nowrap="nowrap">
							<img
								onclick="myshowconfigDiv('<s:property value="#index.count"/>');"
								id="searchImg<s:property value="#index.count"/>" alt="查看详细"
								title="查看详细" border="0" style="CURSOR: pointer"
								src="resource/images/Search.gif">
						</td>
						<td id="empFixBuTie<s:property value="#index.count"/>"
							align="center" nowrap="nowrap">
							<s:property value="showColumn8" />
						</td>

						<td id="emp4Money<s:property value="#index.count"/>" align="right"
							nowrap="nowrap">
							&nbsp;
							<s:property value="showColumn15" />
						</td>
						<td align="left" nowrap="nowrap">
							<s:if test="espBenefitPlans>0">
								<img
									onclick="showBeneModifyDiv('<s:property value="#index.count"/>');"
									id="benesearchImg<s:property value="#index.count"/>" alt="查看详细"
									title="查看详细" border="0" style="CURSOR: pointer"
									src="resource/images/Search.gif" />
							</s:if>
						</td>

						<td id="empTaxamt<s:property value="#index.count"/>"
							align="center" nowrap="nowrap">
							<s:property value="showColumn18" />
						</td>
						<td id="empNetamt<s:property value="#index.count"/>"
							align="center" nowrap="nowrap">
							<s:property value="showColumn19" />
						</td>
						<ty:auth auths="201">
							<td id="td_esac<s:property value='%{#index.count}'/>"
								align="center">
								<s:property value="espEsavId.esavEsac.esacName" />
							</td>
						</ty:auth>
					</tr>
				</s:iterator>
			</s:if>

			<s:else>
				<tr>
					<td align="center" colspan="11">
						<span id="infomation"> 无符合条件的员工薪资发放信息! </span>
					</td>
				</tr>
			</s:else>
		</table>
		<s:pager end="page.end" pageNo="page.currentPage"
			totalRows="page.totalRows" totalPages="page.totalPages"
			formId="mySalaryPaid" start="page.start" />
		<div id="tmpletId" style="DISPLAY: none">
			<img src="resource/images/basic_search.gif"
				onload="HRMCommon.check_order();" />
		</div>
	</s:form>


	<!-- -salary pay div begin -->
	<div id="dlgEmpSalaryPay" class="prompt_div_inline" style="width: 460;">
		<input id="div_empid" type="hidden" name="hiddenName" />
		<input id="employeename" type="hidden" name="hiddenName" />
		<input id="div_rowIDPay" type="hidden" name="hiddenName" />

		<div id="change_stutus_error" class="prompt_div_err"></div>
		<table id="newConfigTable" class="prompt_div_body" width="100%">
			<tr>
				<td valign="center">
					薪资发放备注:
				</td>
				<td colspan="3" valign="center">
					<s:textarea id="div_espComments" cols="30" rows="2" disabled="true" />
				</td>
			</tr>
			<tr>
				<td colspan="9" class="prompt_div_bottom">
					<input class="button" type="button" name="closeButton"
						onclick="HRMCommon.closeDialog('dlgEmpSalaryPay');" value="关闭">
				</td>
			</tr>
		</table>
	</div>


	<!-- -salary pay div end -->

	<!-- 平均工资计算开始 -->
	<div id="dlgComputeAvgPay" class="prompt_div_inline"
		style="width: 460;">
		<table class="prompt_div_body" width="100%">
			<tr>
				<th align="center" width="50%"
					style="border-right: 0px solid #555555">
					<strong>时间范围</strong>
				</th>
				<th align="center" width="25%"
					style="border-right: 0px solid #555555">
					<strong>税前收入</strong>
				</th>
				<th align="center" width="25%"
					style="border-right: 0px solid #555555">
					<strong>税后收入</strong>
				</th>
			</tr>
			<tr>
				<td align="center" nowrap="nowrap">
					前12月(
					<span id="12_period"></span>):
				</td>
				<td>
					<input class='nothinginput' id="12_avg_pay_b" name="12_avg_pay_b"
						size="10" readonly="readonly" style="text-align: right" />
				</td>
				<td>
					<input class='nothinginput' id="12_avg_pay" name="12_avg_pay"
						size="10" readonly="readonly" style="text-align: right" />
				</td>
			</tr>
			<tr>
				<td align="center" nowrap="nowrap">
					上年度(
					<span id="lastyear_period"></span>):
				</td>
				<td>
					<input class='nothinginput' id="lastyear_avg_pay_b"
						name="12_avg_pay_b" size="10" readonly="readonly"
						style="text-align: right" />
				</td>
				<td>
					<input class='nothinginput' id="lastyear_avg_pay"
						name="lastyear_avg_pay" size="10" readonly="readonly"
						style="text-align: right" />
				</td>
			</tr>
			<tr>
				<td colspan="3">
					&nbsp;
				</td>
			</tr>
			<tr>
				<td align="center">
					<table border="0">
						<tr>
							<td nowrap="nowrap">
								起始年月:
								<s:select id="computeStartYear" name="computeStartYear"
									list="years" emptyOption="false" />
								<s:select id="computeStartMonth" name="computeStartMonth"
									list="#{'01':'01','02':'02','03':'03','04':'04','05':'05','06':'06','07':'07','08':'08','09':'09','10':'10','11':'11','12':'12'}"
									emptyOption="false" />
							</td>
						</tr>
						<tr>
							<td nowrap="nowrap">
								终止年月:
								<s:select id="computeEndYear" name="computeEndYear" list="years"
									emptyOption="false" />
								<s:select id="computeEndMonth" name="computeEndMonth"
									list="#{'01':'01','02':'02','03':'03','04':'04','05':'05','06':'06','07':'07','08':'08','09':'09','10':'10','11':'11','12':'12'}"
									emptyOption="false" />
							</td>
						</tr>
					</table>
				</td>
				<td>
					<input class='nothinginput' id="selected_avg_pay_b"
						name="selected_avg_pay_b" size="10" readonly="readonly"
						style="text-align: right" />
				</td>
				<td>
					<input class='nothinginput' id="selected_avg_pay"
						name="selected_avg_pay" size="10" readonly="readonly"
						style="text-align: right" />
				</td>
			</tr>
			<tr>
				<td colspan="3" class="prompt_div_bottom">
					<input id="ebfAddbtn" class="button" type="button" value="计算"
						onClick="compuGivenAvgPay();" />
					<input class="button" type="button" value="取消"
						onclick="HRMCommon.closeDialog('dlgComputeAvgPay');" />
				</td>
			</tr>
		</table>
	</div>

	<!-- 平均工资计算结束 -->
	<script type="text/javascript" language="javascript">
	//薪资发放层
	var acctItemLength;
	function myshowconfigDiv(index) {
		var payId = document.getElementById("salarypayID" + index).value;
		var empId = document.getElementById("empid" + index).value;
		var empName = document.getElementById("empName" + index).value;
		var acctName = document.getElementById("espEsacName" + index).value;
		var year_month = document.getElementById("yearAndMonth" + index).innerHTML;
		document.getElementById("div_rowID").value = index;

		$('#dlgEmpSalaryPay').dialog("option", "title",
				empName + "的薪资发放信息—" + acctName + "(" + year_month + ")");
		document.getElementById("div_espComments").value = document
				.getElementById("espComment" + index).value.trim();

		for ( var i = 0; i < acctItemLength; i++) {
			document.getElementById('acctItems' + i).parentNode
					.removeChild(document.getElementById('acctItems' + i));
		}

		DWRforSalaryPaid.initCalcPay(payId, empId, year_month, callBack);
		function callBack(msg) {
			var trObj;
			acctItemLength = msg.length / 2;
			//alert(acctItemLength);

			for ( var i = 0; i < msg.length; i++) {
				if (i % 2 == 0) {
					trObj = document.getElementById('newConfigTable')
							.insertRow(i / 2);
					trObj.id = 'acctItems' + (i / 2);
					trObj.name = 'div_tr';
				}
				var toWrite = toWrite = "readOnly class='nothinginput'";
				toWrite = toWrite + " style='text-align:right'";

				tdObj = document.createElement('td');
				tdObj.align = 'left';
				tdObj.width = '25%';
				tdObj.height = '27px';
				tdObj.nowrap = 'true';
				tdObj.innerHTML = "<label for='empsalaryconfig.escColumn"
						+ (i + 1) + "'>" + msg[i].esaiEsdd.esddName
						+ ":</label>";
				trObj.appendChild(tdObj);
				tdObj = document.createElement('td');
				tdObj.align = 'left';
				tdObj.height = '27px';
				tdObj.width = '25%';
				tdObj.innerHTML = "<input type='text' " + toWrite
						+ " name='espColumn' id='espColumn" + (i + 1) + "' "
						+ "value='" + msg[i].itemConfigValue.toFixed(2) + "'"
						+ " size='9'/>";
				trObj.appendChild(tdObj);
				if (i == msg.length - 1 && msg.length % 2 == 1) {
					tdObj = document.createElement('td');
					tdObj.width = '25%';
					tdObj.height = '27px';
					trObj.appendChild(tdObj);
					tdObj = document.createElement('td');
					tdObj.width = '25%';
					tdObj.height = '27px';
					trObj.appendChild(tdObj);
				}
			}
		}

		HRMCommon.openDialog('dlgEmpSalaryPay');
	}

	//检查所选择年月是否正确
	function checkYearAndMonth() {
		var startMonth = document.getElementById('inputStartMonth').value;
		var endMonth = document.getElementById('inputEndMonth').value;
		if (startMonth < 10)
			startMonth = "0" + startMonth;
		if (endMonth < 10)
			endMonth = "0" + endMonth;
		var startYearAndMonth = document.getElementById('inputStartYear').value
				+ startMonth;
		var endYearAndMonth = document.getElementById('inputEndYear').value
				+ endMonth;
		if (startYearAndMonth > endYearAndMonth) {
			alert("起始年月大于结束年月，请重新选择年月！");
			return false;
		}
		document.getElementById("mySalaryPaid").submit();
	}

	HRMCommon.initDialog('dlg_emp_benefit_div');
	HRMCommon.initDialog('dlgEmpSalaryPay');
	model.simple.setParentIFrameFull("IFrame1"); // add by 陈钊（计算iframe高度）
</script>
</body>